import java.util.Map;

public class Generator {

	public static Integer howManySets() {return 6;}
	public static Integer howManyQuestionsInEachSet() {return 23;}
	Integer[] mandatoryQuestions = { 3, 12, 24, 32, 45, 53, 54, 56, 70, 79, 81};

	public TestSet[] generate(QandAList qAndAList) throws Exception {
		Map<Integer, Question> questionMap = qAndAList.getQuestionMap();
		
		if ((questionMap.size() - mandatoryQuestions.length) < ((Generator.howManyQuestionsInEachSet() - mandatoryQuestions.length) * Generator.howManySets())) {
			int minAmount = ((Generator.howManyQuestionsInEachSet() - mandatoryQuestions.length) * Generator.howManySets())
					+ mandatoryQuestions.length;
			throw new Exception(
					"There is to little questions. Minimal amount is "
							+ minAmount);
		}
		TestSet[] ts4q = new TestSet[Generator.howManySets()];
		for (int i = 0; i < Generator.howManySets(); i++)
			ts4q[i] = new TestSet(Generator.howManyQuestionsInEachSet(), questionMap,
					mandatoryQuestions);
		return ts4q;
	}
}
